package com.hellomeng.io;

import java.io.*;

public class BufferFileInputOutputTest {

//    public static void main(String[] args) throws IOException {
//        File fileIn = new File("TestData/readerFile.txt");
//        File fileOut = new File("TestData/writeFileB.txt");
//        FileInputStream fis = new FileInputStream(fileIn);
//        FileOutputStream fos = new FileOutputStream(fileOut);
//
//        BufferedInputStream bis = new BufferedInputStream(fis);
//        BufferedOutputStream bos = new BufferedOutputStream(fos);
//
//        byte[] buffer = new byte[10];
//        int len = bis.read(buffer);
//        while (len != -1){
//            bos.write(buffer,0,len);
//            len = bis.read(buffer);
//        }
//
//        //关闭外层，内层自动关闭
//        bis.close();
//        bos.close();
//    }

//    public static void main(String[] args) throws IOException {
//        File fileIn = new File("TestData/readerFile.txt");
//        File fileOut = new File("TestData/writeFileBBB.txt");
//        BufferedReader br = new BufferedReader(new FileReader(fileIn));
//        BufferedWriter bw = new BufferedWriter(new FileWriter(fileOut));
//
//        char[] cbuf = new char[20];
//        int len = br.read(cbuf);
//        while (len != -1){
//            bw.write(cbuf,0,len);
//            len = br.read(cbuf);
//        }
//
//        br.close();
//        bw.close();
//    }
}
